import {
	HtmlViewActionType,
	IHtmlViewAbility,
	IHtmlViewControllerParams,
	IHtmlViewModel,
	IHtmlViewStore,
	IParam,
	IViewEvent,
} from '@/core';
import { QXEvent } from 'qx-util';
import {
	getViewClassNames,
	useViewAction,
	useViewBasic,
	useViewControllerParams,
	useViewProps,
} from '../use-view';

/**
 * 获取Html视图输入参数
 *
 * @export
 * @return {*}
 */
export function useHtmlViewProps() {
	return {
		...useViewProps(),
	};
}

/**
 * 获取Html视图基础
 *
 * @export
 * @param {IHtmlViewModel} model Html视图模型
 * @param {IParam} props 输入参数
 * @return {*}
 */
export function useHtmlViewBasic(model: IHtmlViewModel,props: IParam) {
	const getClassNames = (props:IParam) =>{
		return getViewClassNames(model, props)
	}
	return {
		...useViewBasic(model,props),
		getClassNames,
	};
}

/**
 * Html视图行为
 *
 * @export
 */
export function useHtmlViewAction(controller: any) {
	return {
		...useViewAction(controller),
	};
}

/**
 * 获取Html视图控制器输入参数
 *
 * @export
 * @param {IHtmlViewModel} model
 * @param {IParam} props
 * @param {QXEvent<IViewEvent<HtmlViewActionType, IHtmlViewAbility>>} evt
 * @return {*}  {IHtmlViewControllerParams<HtmlViewActionType, IHtmlViewAbility>}
 */
export function useHtmlViewControllerParams(
	model: IHtmlViewModel,
	props: IParam,
	evt: QXEvent<IViewEvent<HtmlViewActionType, IHtmlViewAbility>>
): IHtmlViewControllerParams<HtmlViewActionType, IHtmlViewAbility> {
	return {
		...useViewControllerParams<IHtmlViewStore, IHtmlViewModel>(
			model,
			props,
			evt
		),
	};
}
